package com.hertz.alarm.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.hertz.alarm.dao.AbstractEntity;
import com.hertz.alarm.util.JsonMapperHelper;

@Entity
@Table(name="iris_version",catalog="app_myiris")
@NamedQueries({
	@NamedQuery(name = IrisVersion.GET_BY_VERSION_CODE,query = "from IrisVersion where versionCode=? ")
})
public class IrisVersion implements AbstractEntity<Integer>{

	public static final String GET_BY_VERSION_CODE = "getByVersionCode";
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@Column(name="version_code")
	private int versionCode;
	@Column(name="version_name")
	private String versionName;
	private boolean forced;
	private long ctime;
	@Column(name="download_path")
	private String downloadPath;
	private String des;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public int getVersionCode() {
		return versionCode;
	}
	public void setVersionCode(int versionCode) {
		this.versionCode = versionCode;
	}
	public String getVersionName() {
		return versionName;
	}
	public void setVersionName(String versionName) {
		this.versionName = versionName;
	}
	public boolean getForced() {
		return forced;
	}
	public void setForced(boolean forced) {
		this.forced = forced;
	}
	public long getCtime() {
		return ctime;
	}
	public void setCtime(long ctime) {
		this.ctime = ctime;
	}
	public String getDownloadPath() {
		return downloadPath;
	}
	public void setDownloadPath(String downloadPath) {
		this.downloadPath = downloadPath;
	}
	public String getDes() {
		return des;
	}
	public void setDes(String des) {
		this.des = des;
	}
	
	public String toJson(){
		String value = "";
		try {
			value =  JsonMapperHelper.objectMapper.writeValueAsString(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return value;
	}
}
